<?php


// 处理字符串防止特殊符号引起的错误，
$process_include    = array('job_name', 'treatment', 'link_man', 'notice');
string_pre_process($record, $process_include);
extract($record, EXTR_OVERWRITE);


$chk_display_0 = '';
$chk_display_1 = '';
$var            = 'chk_display_' . $display;
$$var   = 'checked';
$chk_anytime    = '';
$chk_anynum     = '';
if($anytime == 1) $chk_anytime = 'checked';
if($anynum == 1) { $chk_anynum = 'checked'; $num = '';}



$requirement = unserialize($requirement);
if($begin_time <= 0) $begin_date = date('Y-m-d', $timestamp); 
else $begin_date = date('Y-m-d', $begin_time); 


if($anytime == 1) {
    $end_date = '';
} else {
    if ($end_time <= 0)   $end_date = '';
    elseif ($end_time == $G_big_integer) {
        $anytime == 1;
        $end_date = '';
    }
    else $end_date = date('Y-m-d', $end_time);
}


// 取得返回字符串
$back_url   = strcode(getcookie('back_url'), 'DECODE');
if($back_url == '') $back_url   = $mod_url['li'];



if($action == 'modify') {
    $txt_form_title = "修改职位";
    $cur_tab_menu   = "not_exist";
} else {
    $txt_form_title = "新增职位";
    $cur_tab_menu   = "admin_add";
}

require($abs_admin_cppath . '/header.php');
?>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common'] ?>/js/Validator.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common'] ?>/js/popcalendar.js"></SCRIPT>
<div class="sp_height_5px"></div>




	<div class="datacontainer2" style="width:600px;">

<div class="header">
<?php echo $txt_form_title ?>
</div>
<table BORDER="0" cellpadding="0" cellspacing="0" width="100%" class="list_table">
<form action="<?php echo $mod_url['save'] ?>" method="post" name="user_data" onsubmit="return Validator.Validate(this,3);">
<TR>
	<TD width="120" align="right" class="caption">职位名称</TD>
	<TD class="cell">
		<input type="text" name="job[job_name]" value="<?php echo $job_name?>" class="text" size="40"
		Require="true" dataType="Limit" min="1" max="100" msg="“职位名称”必须填写且不能超过100个字符！">
		<span class="mustfill">*</span>
	</TD>
</TR>
<TR>
	<TD width="120" align="right" class="caption">是否显示</TD>
	<TD class="cell">
		<INPUT TYPE="radio" NAME="job[display]" ID="display_1" VALUE="1" <?php echo $chk_display_1 ?>> <label for="display_1">显示</label> 
		<INPUT TYPE="radio" NAME="job[display]" ID="display_0" VALUE="0" <?php echo $chk_display_0 ?>> <label for="display_0">不显示</label>
	</TD>
</TR>
<TR>
	<TD width="120" align="right" class="caption">招聘人数</TD>
	<TD class="cell">
		<input type="text" name="job[num]" value="<?php echo $num ?>" class="text textright" size="4"
		onkeypress="return non_num_filter(this);"
		>
	<INPUT TYPE="checkbox" NAME="job[anynum]" ID="anynum" VALUE="1" <?php echo $chk_anynum ?>> <label for="anynum">不限</label>
	</TD>
</TR>
<TR>
	<TD width="120" align="right" class="caption">工作待遇</TD>
	<TD class="cell">
		<input type="text" name="job[treatment]" value="<?php echo $treatment?>" class="text" size="40"
		Require="true" dataType="Limit" min="1" max="100" msg="“工作待遇”必须填写且不能超过100个字符！"
		>
		<span class="mustfill">*</span>
	</TD>
</TR>
<TR>
	<TD width="120" align="right" class="caption">工作地点</TD>
	<TD class="cell">
		<input type="text" name="job[city]" value="<?php echo $city ?>" class="text" size="40"
		Require="false" dataType="Limit" max="100" msg="“工作地点”不能超过100个字符！"
		>
	</TD>
</TR>



<TR>
	<TD width="120" align="right" class="caption">有效时间</TD>
	<TD class="cell">
		从<input type="text" name="job[begin_date]" id="begin_date" value="<?php echo $begin_date ?>" class="text" size="12" style="font-size:10px">
	<script language=JavaScript>
		arrowtag("begin_date",'<?php echo $url_global['common'] ?>/images/datetime.gif');
	</script> 至 <input type="text" name="job[end_date]" id="end_date" value="<?php echo $end_date ?>" class="text" size="12" style="font-size:10px">
	<script language=JavaScript>
		arrowtag("end_date",'<?php echo $url_global['common'] ?>/images/datetime.gif');
	</script>

	<INPUT TYPE="checkbox" NAME="job[anytime]" ID="anytime" VALUE="1" <?php echo $chk_anytime ?>> <label for="anytime">长期有效</label>
	</TD>
</TR>

<TR>
	<TD width="120" align="right" class="caption">联系方式</TD>
	<TD class="cell">
		联系人：
		<input type="text" name="job[link_man]" value="<?php echo $link_man ?>" class="text"
		Require="false" dataType="Limit" max="100" msg="“联系方式”不能超过100个字符！"
		>
		&nbsp;&nbsp;&nbsp;&nbsp;
		联系电话：
		<input type="text" name="job[tel]" value="<?php echo $tel ?>" class="text"
		Require="false" dataType="Limit" max="100" msg="“联系电话”不能超过100个字符！"
		>
	</TD>
</TR>


<TR>
	<TD width="120" align="right" class="caption">职位要求</TD>
	<TD class="cell">
		<TABLE border="0" cellpadding="1" cellspacing="1" class="non_border">
	<TR>
		<TD valign="top" style="vertical-align:top;padding-top:0px"><TABLE border="0" width="100%" cellpadding="1" cellspacing="1" id="require_table" style="margin-top:0px;">
	<TR>
		<TD width="20" align="center">#</TD>
		<TD>职位要求</TD>
		<TD width="40"><input type="button" onclick="addRow();" value="增加" class="btn" style="color:red" /></TD>
	</TR>
<?php
if($action == 'modify' && is_array($requirement) && sizeof($requirement) > 0) {
    $icount = 1;
    foreach($requirement as $v) {
?>
	<TR>
		<TD width="20" align="center"><?php echo $icount ?>.</TD>
		<TD><input type="text" name="requirement[]" maxlength="255" value="<?php echo $v ?>" class="text" size="50"></TD>
		<TD width="40"><input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, 1);" value="删除" class="btn" /></TD>
	</TR>
<?php
        $icount ++;
    }
} else {
?>
	<TR>
		<TD width="20" align="center">1.</TD>
		<TD><input type="text" name="requirement[]" maxlength="255" class="text" size="50"></TD>
		<TD width="40"><input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, 1);" value="删除" class="btn" /></TD>
	</TR>
	<TR>
		<TD width="20" align="center">2.</TD>
		<TD><input type="text" name="requirement[]" maxlength="255" class="text" size="50"></TD>
		<TD width="40"><input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, 1);" value="删除" class="btn" /></TD>
	</TR>
	<TR>
		<TD width="20" align="center">3.</TD>
		<TD><input type="text" name="requirement[]" maxlength="255" class="text" size="50"></TD>
		<TD width="40"><input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, 1);" value="删除" class="btn" /></TD>
	</TR>
	<TR>
		<TD width="20" align="center">4.</TD>
		<TD><input type="text" name="requirement[]" maxlength="255" class="text" size="50"></TD>
		<TD width="40"><input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, 1);" value="删除" class="btn" /></TD>
	</TR>
<?php
}
?>
	</TABLE>
		</TABLE>


<SCRIPT LANGUAGE="JavaScript">
<!--
var amount = 4;
function addRow(){
    var table = GE("require_table");
    mynewrow = table.insertRow();

    amount  ++;
    mynewcell_0=mynewrow.insertCell();
    mynewcell_0.align = 'center';
    mynewcell_0.innerHTML= amount + '.';
    mynewcell_1=mynewrow.insertCell();
    mynewcell_1.innerHTML='<input type="text" name="requirement[]" maxlength="255" class="text" size="50">';

    mynewcell_2=mynewrow.insertCell();
    mynewcell_2.innerHTML='<input type="button" onclick="deleteRow(this.parentNode.parentNode.rowIndex, '+amount+');" value="删除" class="btn" />';
}

function deleteRow(id, num){
    var table = GE("require_table");
    table.deleteRow(id);
}
//-->
</SCRIPT>


	</TD>
</TR>

<TR>
	<TD width="120" align="right" class="caption">其他注意事项</TD>
	<TD class="cell">
		<TEXTAREA NAME="job[notice]" ROWS="8" COLS="40" class="area wp90"><?php echo $notice ?></TEXTAREA>
	</TD>
</TR>



<TR>
	<TD class="submit" colspan="2" align="center">
		<input type="submit" value=" 保存 " class="btn">
		<input type="reset" value=" 重置 " class="btn">
		<input type="button" value=" 返回 " class="btn" onclick="location.href='<?php echo $back_url ?>'">
		<input type="hidden" name="job[id]" value="<?php echo $id ?>">
		<input type="hidden" name="save" value="<?php echo $save_flag ?>">
	</TD>
</TR>
</form>
</TABLE>
	</div>
<?php
require($abs_admin_cppath . '/footer.php');
?>